<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page     import="controller.NewOrder"%>
<%@ page     import="hibernate.Orderstab"%>
<%@ page     import="hibernate.Driverstab"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>查看订单</title>
	<script src="js/jquery-1.8.3.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
	
	<SCRIPT LANGUAGE="javascript"> 
  		var idTmr;
        function method1(tableid) {//整个表格拷贝到EXCEL中
            	
            var curTbl = document.getElementById(tableid);
            alert(tableid);  
            var oXL = new ActiveXObject("Excel.Application");
            
            //创建AX对象excel
            var oWB = oXL.Workbooks.Add();
            //获取workbook对象
            
            var xlsheet = oWB.Worksheets(1);
            //激活当前sheet
            
            var sel = document.body.createTextRange();
            sel.moveToElementText(curTbl);
            //把表格中的内容移到TextRange中
            sel.select();
            //全选TextRange中内容
            
            sel.execCommand("Copy");
            //复制TextRange中内容 
            xlsheet.Paste();
            //粘贴到活动的EXCEL中      
            oXL.Visible = true;
            //设置excel可见属性
            

            

            try {
                var fname = oXL.Application.GetSaveAsFilename("将Table导出到Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
            } catch (e) {
                print("Nested catch caught " + e);
            } finally {
                oWB.SaveAs(fname);

                oWB.Close(savechanges = false);
                //xls.visible = false;
                oXL.Quit();
                oXL = null;
                //结束excel进程，退出完成
                //window.setInterval("Cleanup();",1);
                idTmr = window.setInterval("Cleanup();", 1);

            }
        }
        function Cleanup() {
            window.clearInterval(idTmr);
            CollectGarbage();
        }
  
    </SCRIPT>

  </head>
  
  <body style="background-image:url('images/bg1.gif')">
  	<h4>已处理订单列表</h4>
         <form action="processExcelAction.action" method="post">
         <table id="table" border="1" cellpadding="5" cellspacing="3" class="table table-hover">
   <tr>
   <!-- <td>选择</td> -->
   <th>订单ID</th>
   <!-- <th>车牌号</th> -->
   <th>预定车位数量</th>
   <th>下单时间</th>
   <th>预定时间</th>
   <th>完成时间</th>
   <th>订单金额</th>

   </tr>
   <%
     NewOrder neworder=new NewOrder();
     
         List<Orderstab> list=neworder.treatedOrders((Integer)request.getSession().getAttribute("parkID"));
         if(list!=null){
         for(Orderstab ft:list){%>
         
          <tr>
          	  <!-- <td><input type="checkbox" name="check" value="<%= ft.getUuid()%>"/> </td> -->
         	  <td><%= ft.getUuid()%></td>         	  
              <td><%= ft.getOrderNumber()%></td>
              <td><%= ft.getPushTime()%></td>
              <td><%= ft.getOrderTime()%></td>
              <td><%= ft.getFinishTime()%></td>
              <td><%= ft.getPrice()%></td>
                   
          </tr>
         <% }%>
         
     <% } %>
    
       </table>
       <!--  <button type="button" onclick="check_all('check');">全选</button>
       <button type="button" onclick="uncheck_all('check');">取消</button>
       <input type="button" name="out_excel" onclick="AutomateExcel();" value="导出到excel" class="notPrint">
       <input  type="submit" value="确认"/>  -->
      <br/>
      <input type="submit" value="导出到excel" >
       </form>
  </body>
</html>
